package bdz.projects.cbt.utils
{
	import flash.events.EventDispatcher;
	import flash.media.Sound;
	import flash.media.SoundChannel;
	import flash.utils.getDefinitionByName;

	public class CBTSounds extends EventDispatcher{
		private static var soundon:Boolean = true;
		public function CBTSounds(){
			super();
		}
		private static function createSound(o:Object):void{
			if(!soundon) return;
			var soundPlayer:Sound = new o() as Sound;
			var chan:SoundChannel = soundPlayer.play();
		}
		public static function playProfit():void{
			createSound(getDefinitionByName("profit"));
		} 
		public static function playBubble():void{
			createSound(getDefinitionByName("bubble"));
		}
		public static function playUpgrade():void{
			createSound(getDefinitionByName("upgrade"));
		}
		public static function playTravel():void{
			createSound(getDefinitionByName("travel"));
		}
		public static function enableSound(b:Boolean):void{
			soundon = b;
		}
		public static function get isSoundEnabled():Boolean{
			return soundon;
		}
	}
}
